package com.example.team.controller;

import com.example.team.entity.SafetyEquipmentPurchaseDate;
import com.example.team.service.ISafetyEquipmentPurchaseDateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 编写者：蓝江富
 * 时间：2023年10月31日18:42:08
 */
@RestController
@Api(tags = "劳保采购记录")
public class SafetyEquipmentPurchaseDateController {
    @Autowired
    private ISafetyEquipmentPurchaseDateService safetyEquipmentPurchaseDateService;

    @ApiOperation(value = "添加劳保采购记录",
            notes = "成功返回1")
    @RequestMapping("/insertSafetyEquipmentPurchaseDate")
    public int insertSafetyEquipmentPurchaseDate(SafetyEquipmentPurchaseDate safetyEquipmentPurchaseDate){
        return safetyEquipmentPurchaseDateService.insertSafetyEquipmentPurchaseDate(safetyEquipmentPurchaseDate);
    }

    @ApiOperation(value = "删除劳保采购记录",
            notes = "成功返回1")
    @RequestMapping("/deleteSafetyEquipmentPurchaseDate")
    public int deleteSafetyEquipmentPurchaseDate(Integer id){
        SafetyEquipmentPurchaseDate safetyEquipmentPurchaseDate=new SafetyEquipmentPurchaseDate();
        safetyEquipmentPurchaseDate.setPurchaseDateId(id);
        return safetyEquipmentPurchaseDateService.deleteSafetyEquipmentPurchaseDate(safetyEquipmentPurchaseDate);
    }

    @ApiOperation(value = "修改劳保采购记录信息",
            notes = "成功返回1")
    @RequestMapping("/updateSafetyEquipmentPurchaseDate")
    public int updateSafetyEquipmentPurchaseDate(SafetyEquipmentPurchaseDate safetyEquipmentPurchaseDate){
        return safetyEquipmentPurchaseDateService.updateSafetyEquipmentPurchaseDate(safetyEquipmentPurchaseDate);
    }

    @ApiOperation(value = "查询所有劳保采购记录信息",
            notes = "成功返回Json")
    @RequestMapping("/getAllSafetyEquipmentPurchaseDate")
    public List<SafetyEquipmentPurchaseDate> getAllSafetyEquipmentPurchaseDate(Integer examiner){
        SafetyEquipmentPurchaseDate safetyEquipmentPurchaseDate=new SafetyEquipmentPurchaseDate();
        safetyEquipmentPurchaseDate.setExaminer(examiner);
        return safetyEquipmentPurchaseDateService.getAllSafetyEquipmentPurchaseDate(safetyEquipmentPurchaseDate);
    }

    @ApiOperation(value = "查询劳保采购记录信息",
            notes = "成功返回Json")
    @RequestMapping("/getSafetyEquipmentPurchaseDate")
    public SafetyEquipmentPurchaseDate getSafetyEquipmentPurchaseDate(Integer examiner){
        SafetyEquipmentPurchaseDate safetyEquipmentPurchaseDate=new SafetyEquipmentPurchaseDate();
        safetyEquipmentPurchaseDate.setExaminer(examiner);
        return safetyEquipmentPurchaseDateService.getSafetyEquipmentPurchaseDate(safetyEquipmentPurchaseDate);
    }
}
